'use strict'

const crypto = require('crypto')
const uuid = require('node-uuid')
const dateFormat = require('dateformat')
const axios = require('axios')

module.exports = {
  dateformat(date = Date.now(), format = 'yyyymmddHHMMss') {
    return dateFormat(date, format)
  },
  md5(text = '') {
    return crypto.createHash('md5').update(text).digest('hex')
  },
  encrypt(content = '') {
    return crypto.createHmac('sha256', this.config.keys)
      .update(content)
      .digest('hex')
  },
  uuid,
  axios,
}
